import {
	request,
	uploadRequest
} from "@/utils/request.js"


export function apiLogin(data = {}) {
	return request({
		url: "/api/login",
		data,
		method: "post"
	})
}

export function apiCourse(data = {}) {
	return request({
		url: "/api/timeTable",
		data,
		method: "post",
	})
}

export function apiDairyLog(data = {}) {
	return request({
		url: "/api/logInsert",
		data,
		method: "post",
	})
}

export function apiVerifyToken(data = {}) {
	return request({
		url: "/api/apiVerifyToken",
		data,
		method: "post"
	})
}

export function apiGetDateLog(data = {}) {
	return request({
		url: "/api/apiGetDateLog",
		data,
		method: "post"
	})
}

export function apiGetHomeWork(data = {}) {
	return request({
		url: "/api/apiGetHomeWork",
		data,
		method: "post"
	})
}

export function apiSubmitHomeWork(data = {}) {
	return request({
		url: "/api/apiSubmitHomeWork",
		data,
		method: "post"
	})
}

export function apiGetHomeWorkDetail(data = {}) {
	return request({
		url: "/api/apiGetHomeWorkDetail",
		data,
		method: "post"
	})
}

export function apiInsertAttendence(data = {}) {
	return request({
		url: "/api/apiInsertAttendence",
		data,
		method: "post"
	})
}

export function apiGetScore(data = {}) {
	return request({
		url: "/api/score",
		data,
		method: "post",
	})
}

export function apiRevisePassword(data = {}) {
	return request({
		url: "/api/revisePassword",
		data,
		method: "post"
	})
}

export function apiIsSubmitHomeWork(data = {}) {
	return request({
		url: "/api/apiIsSubmitHomeWork",
		data,
		method: "post"
	})
}

export function apigetCourseFiles(data = {}) {
	return request({
		url: "/api/getCourseFiles",
		data,
		method: "post" // 使用大写表示请求方法
	})
}

export function apiUploadFiles(data = {}) {
	return request({
		url: "/api/UploadFiles",
		data,
		method: "post" // 使用大写表示请求方法
	})
}

export function apiDeleteFiles(data = {}) {
	return request({
		url: "/api/deleteFiles",
		data,
		method: "post" // 使用大写表示请求方法
	})
}


export function apiDeleteDiaryFiles(data = {}) {
	return request({
		url: "/api/deleteDiaryFiles",
		data,
		method: "post" // 使用大写表示请求方法
	})
}
export function apiConvertPPTToImages(data = {}) {
	return request({
		url: "/api/convertPPToimages",
		data,
		method: "post" // 使用大写表示请求方法
	})

}


export function apigetCourseFilesdetails(data = {}) {
	return request({
		url: "/api/getApiCourseFiles",
		data,
		method: "post"
	})
}

// 获得url
export function apiGetUrlFiles(data = {}) {
	return request({
		url: "/api/getFileUrl",
		data,
		method: "post"
	})
}


// 作业文件上传的 API
export function apiUploadFile(params = {}) {
	const {
		filePath,
		studentId,
		homeWorkId
	} = params;
	return uploadRequest({
		url: '/api/UploadHomeWorkFiles',
		filePath,
		formData: {
			studentId: Number(studentId),
			homeWorkId: Number(homeWorkId)
		}
	});
}

// 日志文件上传的 API
export function apiUploadDiaryFile(params = {}) {
	const {
		filePath,
		date,
		userId,
		projectId
	} = params;
	return uploadRequest({
		url: '/api/UploadDairyFiles',
		filePath,
		formData: {
			date: date,
			userId: Number(userId),
			projectId: Number(projectId)
		}
	});
}